Get a list of client cost centers

This request is used to get a list of existing cost centers.

Request syntax

GET https://b2b-api.go.yandex.ru/integration/2.0/cost_centers/list?
limit=<number of records>
&offset=<number of records to skip>

Request headers

  • Authorization: Bearer <OAuth-token>
    OAuth access token. The steps to get a token are described in Getting started.
  • X-YaTaxi-Selected-Corp-Client-Id — client ID from the account. Required if multiple clients are available using the token.

Request parameters

The request may contain the following optional parameters:

  • limit: The number of records to print. If this parameter is omitted, information about the first 100 records is returned.

  • offset: The number of records to skip. If this parameter is omitted, information starting from the first record is returned.

Response field description

Responses may contain the following fields:

Field Description Format
items The list of cost centers. Array
limit The maximum number of records to return. Number
offset The number of records skipped. Number
total_amount The number of records found. Number

Structure of the items array element:

Field Description Format
id Cost center ID. String
name The name of the cost center. String
default Indicates whether this cost center is used by default (set when the service is activated for the client). Boolean
field_settings The list of settings for each cost center field. Array

Structure of the field_settings array element:

Field

Description

Format

id

Field ID.

String

hidden

Don't show or use this field when the order is placed.

Boolean

title

The name of the field.

String

required

Indicates whether this field must be filled in when the order is placed.

Boolean

services

IDs of the services in which this field can be used when the order is placed. Currently only taxi is supported.

Array of strings

format

Acceptable values:

  • select: The employee selects the cost center from the list.
  • text: The employee specifies the cost center on their own in the text field.
  • mixed: The employee can both select the cost center from the list and specify it in the text field.

String

values

The list of cost centers available to the employee. List format: "cost_center1", "cost_center2", ....

Array of strings

Request example

GET https://b2b-api.go.yandex.ru/integration/2.0/cost_centers/list?limit=100&offset=0
...
Authorization: Bearer <OAuth token>

Response example

An example response to this request looks like this:

{
  "items": [
    {
      "id": "1234567890abcdef1234567890abcdef",
      "name": "Main cost center",
      "default": true,
      "field_settings": [
        {
          "id": "0123456789abcdef0123456789abcde0",
          "hidden": false,
          "title": "Cost center",
          "required": true,
          "services": ["taxi"],
          "format": "select",
          "values": ["business trip", "to HQ"]
        },
        {
          "id": "0123456789abcdef0123456789abcde1",
          "hidden": false,
          "title": "Ride purpose",
          "services": ["taxi"],
          "required": true,
          "format": "mixed",
          "values": ["purpose 1", "purpose 2", "special purpose"]
        },
        {
          "id": "0123456789abcdef0123456789abcde2",
          "hidden": true,
          "title": "Case number",
          "services": ["taxi"],
          "required": true,
          "format": "text",
          "values": []
        }
      ]
    }
  ],
  "limit": 100,
  "offset": 0,
  "total_amount": 1,
}

Response codes

The response to this request may contain the following standard HTTP codes:

  • 200: Request completed successfully.
  • 400: An unknown parameter or a parameter with an invalid value was passed in the request.
  • 401: The OAuth token is incorrect.
  • 403: The client doesn't have sufficient rights to run this request.
    • SELECT_CLIENT_HEADER_REQUIRED: the request did not pass the header X-YaTaxi-Selected-Corp-Client-Id (returned if more than one client is available for the token).
    • SELECTED_CLIENT_ACCESS_DENIED: the header X-YaTaxi-Selected-Corp-Client-Id contains the client's ID, which this login does not have access to.